<?php

class FerramentaController extends Controller {
    /**
     * @final   pacote das views deste controller
     */
    const PACKAGE_VIEW = 'ferramenta';

    /**
     * @var FerramentaService
     */
    private $ferramentaService;
    /**
     * @var AvisoService
     */
    private $avisoService;
    /**
     * @var AnotacaoService
     */
    private $anotacaoService;
    /**
     * @var FaqService
     */
    private $faqService;

    public function __construct() {
        $this->ferramentaService = FerramentaService::getInstance();
        $this->avisoService = AvisoService::getInstance();
        $this->anotacaoService = AnotacaoService::getInstance();
        $this->faqService = FaqService::getInstance();
    }

    public function aniversariantes() {
        $this->save(SESSION_INTERFACE, 'NextBirthdays', $this->ferramentaService->findBirthdays(TIME_NEXT_BIRTHDAYS));
        $this->view('aniversariantes', self::PACKAGE_VIEW);
    }

    public function listarAvisos() {
        $this->save(SESSION_INTERFACE, 'NoticesList', $this->avisoService->findVisibleNoticeFromLoggedUser());
        $this->view('listar_avisos', self::PACKAGE_VIEW);
    }

    public function listarAnotacoes() {
        $IDUsuario = Dracosys::getLoggedUser()->getIDUsuario();
        $this->save(SESSION_INTERFACE, 'NotesList', $this->anotacaoService->findByUser($IDUsuario));
        $this->view('listar_anotacoes', self::PACKAGE_VIEW);
    }

    public function listarChamadosPreferidos() {
        $this->view('chamados_preferidos', self::PACKAGE_VIEW);
    }

    public function listarPerguntas() {
        $this->save(SESSION_INTERFACE, 'QuestionsList', $this->faqService->findAll());
        $this->view('listar_perguntas', self::PACKAGE_VIEW);
    }

}

?>
